package com.luban.hs.controller;

import com.luban.hs.mode.UserDto;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: hs
 * @Description:
 * @Date: Create in 20:17 2019/2/2
 */
@Controller
public class RequestMappingController {

    @RequestMapping(value = "/queryUserByName",method = RequestMethod.GET)
    @ResponseBody
    public UserDto queryUserByName(UserDto user){
        return user;
    }

    @RequestMapping(value = "/queryUser/{name}",method = RequestMethod.GET)
    @ResponseBody
    public UserDto queryUser(@PathVariable String name){
        UserDto user = new UserDto();
        user.setName(name);
        user.setAge(24);
        return user;
    }

    @RequestMapping(value = "/getUserView.jsp",method = RequestMethod.GET)
    public String getUserView(){
        //可以指定 静态资源路径 和 后缀 默认在static下面
        return "userView.html";
    }
}
